﻿@model List<TanWeb.Models.Entities.ProductProfile>
@{
    ViewBag.Title = "Trang chủ chợ hot";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@Scripts.Render("~/Scripts/Pages/index.js")
<div class="content_banner">
    <p><img src="../../Images/Template/content-banner.jpg" alt="" /></p>
</div>
<!--
<div class="content_title">
    <h3>Sản phẩm mới</h3>
</div>
-->
<div class="box_shadow"></div>
<div class="product_box">
    <div class="content_height10"></div>
    <div class="box_center">
        @if (Model != null && Model.Count <= 0)
        {
            @TanWeb.Helpers.Constants.GRID_EMPTY_WARNING
        }
        else
        {
            for (int i = 0; i < Model.Count % 4; i++)
            {
                Model.Add(null);
            }

            var index = 0;

            <ul>
                @foreach (TanWeb.Models.Entities.ProductProfile item in Model)
                {
                    <li class="product">
                        @{
                            var boxSpClass = string.Format("boxsp{0}", (index + 1) % 4 == 0 ? " border-right-none" : "");
                        }
                        <div class="@boxSpClass">
                            @{
                                if (item != null)
                                {
                                    var productId = "productId" + @index;
                                    var groupId = "groupId" + @index;
                                    var subGroupId = "subGroupId" + @index;
                                    <p><a><img src="@item.GetTempImagePath()" alt="@item.Name" /></a></p>
                                    <h4 class="productname">@item.Name</h4>
                                    <p class="productprice">Giá: @string.Format(@item.Price > 0 ? "{0:#,###} VNĐ" : TanWeb.Helpers.Constants.PRICE_NOT_SET , @item.Price)</p>
                                    <p class="productdescription">@item.Description</p>
                                    <a class="button detail" index="@index">Chi tiết</a>
                                    <input type="hidden" id="@productId" value="@item.id" />
                                    <input type="hidden" id="@groupId" value="@item.GroupId" />
                                    <input type="hidden" id="@subGroupId" value="@item.SubGroupId" />
                                }
                                index++; 
                            }
                        </div>
                    </li>
                }
            </ul>
        }
    </div>
</div>
<input type="hidden" name="productId" id="infoProductId" />
<input type="hidden" name="groupId" id="infoGroupId" />
<input type="hidden" name="subGroupId" id="infoSubGroupId" />
<!--<div class="box_2bottom"></div>-->
